<script setup>
  import {ref,onMounted} from 'vue';
  import axios from 'axios'

  let msg = ref('');

  //axios get 
  /**
   * 
   * axios.postt("url",{json},{参数 param header.. })
   * 
   */

  let getMsg = async ()=>{
    //post : (1.url 2.{} json 3.参数)
    let {data:{content}} = await axios.post("http://forum.atguigu.cn/api/rand.qinghua",{},{
      params:{
        "format":"json"
      }
    });
     msg.value = content;
  }

  onMounted(()=>{
    getMsg();
  })



</script>

<template>
  <div>
     今日情话get： {{ msg }}  <br>
     <button @click="getMsg()">切换</button>
  </div>
</template>

<style scoped>

</style>